package th.ac.tu.engr.timemylife;

import android.app.Service;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.os.IBinder;
import android.util.Log;

public class MyService extends Service {
    private static final String TAG = "MyService";
    private final TickReceiver tickReceiver = new TickReceiver();

    public MyService() {
    }

    @Override
    public void onCreate() {
        super.onCreate();
        SharedPreferences pref = MyApp.getAppPreference();
        // TODO: load settings from preference

        // Register for 1-min notification
        registerReceiver(tickReceiver, new IntentFilter(Intent.ACTION_TIME_TICK));
        // TODO: set handler to connect with server

    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return START_STICKY;
    }

    @Override
    public IBinder onBind(Intent intent) {
        Log.v(TAG, "onBind()");
        // TODO: Return the communication channel to the service.
        throw new UnsupportedOperationException("Not yet implemented");
    }
}
